from django.contrib import admin
from .models import Group, GroupMember, Meeting, MeetingParticipant, MeetingMessage, MeetingMinutes


@admin.register(Group)
class GroupAdmin(admin.ModelAdmin):
    list_display = ['name', 'creator', 'created_at', 'is_active']
    list_filter = ['is_active', 'created_at']
    search_fields = ['name', 'description']


@admin.register(GroupMember)
class GroupMemberAdmin(admin.ModelAdmin):
    list_display = ['group', 'user', 'role', 'joined_at', 'is_active']
    list_filter = ['role', 'is_active', 'joined_at']
    search_fields = ['group__name', 'user__username']


@admin.register(Meeting)
class MeetingAdmin(admin.ModelAdmin):
    list_display = ['title', 'group', 'creator', 'start_time', 'status']
    list_filter = ['status', 'start_time']
    search_fields = ['title', 'description']


@admin.register(MeetingParticipant)
class MeetingParticipantAdmin(admin.ModelAdmin):
    list_display = ['meeting', 'user', 'status', 'join_time']
    list_filter = ['status']
    search_fields = ['meeting__title', 'user__username']


@admin.register(MeetingMessage)
class MeetingMessageAdmin(admin.ModelAdmin):
    list_display = ['meeting', 'sender', 'message_type', 'created_at']
    list_filter = ['message_type', 'created_at']
    search_fields = ['content', 'sender__username']


@admin.register(MeetingMinutes)
class MeetingMinutesAdmin(admin.ModelAdmin):
    list_display = ['meeting', 'generated_by', 'created_at']
    list_filter = ['generated_by', 'created_at']
    search_fields = ['summary', 'content']
